package org.test;

import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class Server {

	public static void main(String[] args) {
		ServerSocket serverSocket = null;
		Socket socket = null;
		InputStream is = null;
		OutputStream os = null;
		BufferedInputStream bfi;
		try {
			serverSocket = new ServerSocket(3232);
			System.out.println("Server is started.");

			StringBuffer sb = new StringBuffer();
			while (true) {
				socket = serverSocket.accept();
				new Thread(new MulThread(socket)).start();
				// is = socket.getInputStream();
				// os = socket.getOutputStream();
				// byte[] buffer = new byte[1024];
				// int len = 0;
				// while ((len = is.read(buffer)) != -1) {
				// os.write(len);
				// sb.append(new String(buffer, 0, len));
				// }
				// System.out.println("Client: " + sb.toString());
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		try {
			is.close();
			os.close();
			socket.close();
			serverSocket.close();
		} catch (IOException e) {
			e.printStackTrace();
		}

	}

}
